import E from 'wangeditor' 
const {
    BtnMenu,
} = E


class ImageExtends extends BtnMenu {
    constructor(editor) {
        const $elem = E.$(
            `<div class="w-e-menu" data-title="图片 ">
                <i class="w-e-icon-image"></i>
            </div>`
        )
        super($elem, editor)

    }
    // 菜单点击事件
    clickHandler(e) {
        Vue.prototype.$vFN.Directives.SelectResourcesImage({
            mode:"wx",
            onSuccess: (res) => {
                // if(!this.editor.resourcesList){
                //     this.editor.resourcesList = {
                //         img:[],
                //         audio:[],
                //         video:[],
                //     }
                // }
                console.error()
                res.data.forEach(item => {
                    this.editor.cmd.do('insertHTML', '<img src='+item+' style="max-width: 100%;"/>')
                    // this.editor.cmd.do('insertHTML', '24242424')
                    this.editor.matchList.push({
                        localUrl:res.all.obj[0].wechatUrl,
                        weChatUrl:res.all.obj[0].albumUrl,
                    })
                })
            },

        });
    }
    tryChangeActive() {  
    }
}
export default ImageExtends